Prevent file system paths from being included in mml3 extension. #993
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Webpack will replaced
import.meta.url
by a literal string for the path of the file on the system where it is being run. That means files that includeimport.meta.url
will have references to the host file system where webpack is run (in our case, the travis-ci servers). Thebeta.3
version worked around this issue in thets/components/loader.ts
file by replacing#root/root.js
with one that uses/
rather thanimport.meta.url
; butts/input/mathml/mml3
also includes references toimport.meta.url
, and so themml3
extension was still incorrectly including the full path name.This PR fixes that problem by having the
mml3
extension call on#root/root.js
to get its root directory and making a path relative to that, rather than trying to look up the equivalent to__dirname
usingimport.meta.url
. That means, in particular, that we don't need the#mml3
pseudo-module only longer, so that is removed from thepackage.json
andtsconfig
files that included it.In addition, we modify the
root-pack.js
file (that replaces#root/root.js
when webpack is used) to look for a MathJax configurationMathJax.config.loader.paths.mathjax
orMathJax.config.__dirname
(the latter being set up bynode-main
) in order to try harder to find a good value for the root directory when used from webpacked files. Also, theesRoot()
function was renamedmjxRoot()
, as that is more meaningful.Finally, the
mml3.serf.json
file also included full file pathnames based on my own file hierarchy, so the package scripts used to create it have been modified to end up using/tmp
rather than my full path to MathJax-src, so at least that is more generic.